import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
// import './registerServiceWorker'
import './plugins/element.js'
import './assets/css/reset.css'
import Element from 'element-ui'
import axios from 'axios'
import Qs from 'qs'
import VideoPlayer from 'vue-video-player'
// import VueClipboard from 'vue-clipboard2'
Vue.use(VideoPlayer)
// 第一个是videoJs的样式，后一个是vue-video-player的样式，因为考虑到我其他业务组件可能也会用到视频播放，所以就放在了main.js内
require('video.js/dist/video-js.css')
require('vue-video-player/src/custom-theme.css')
Vue.prototype.axios = axios
Vue.prototype.qs = Qs
axios.defaults.withCredentials = true
axios.interceptors.request.use(function (config) {
  // let a = f(window.location.href)
  // if(!a.jsessionid) {
  //   window.location = 'http://172.18.70.100:8082/server-api/toLogin?originPage=http://172.18.36.39:8081'
  // } else {
  // }
  return config
})
// navigator.serviceWorker.getRegistrations().then(function(registrations){
//   for(let registration of registrations) {
//   registration.unregister();
//   }
// });
Vue.use(Element)
// Vue.use(VueClipboard)
axios.interceptors.response.use(function (res) {
  return res
}, error => {
  return Promise.reject(error)
})

// function f(e) {
//   var t, n, r, i = e, s = {};
//   t = i.split("?"),
//   r = null,
//   n = null;
//   for (var o in t) {
//       var u = t[o].indexOf("=");
//       u !== -1 && (r = t[o].substr(0, u),
//       n = t[o].substr(u + 1),
//       s[r] = n)
//   }
//   return s
// }

Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
